package com.vy.stl.controller;

import com.vy.stl.constants.Constants;
import com.vy.stl.service.ChartsService;
import com.vy.stl.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @create: 2025/09/05 08:46
 * @description:
 */
@RestController
@RequestMapping("/charts")
public class ChartsController {

    @Autowired
    private ChartsService chartsService;

    /**
     * 会员总数量
     * @return
     */
    @RequestMapping("/memberTotal")
    public Result memberTotal() {
        return Result.success(Constants.STATUS_200,chartsService.getMemberTotal());
    }

    /**
     * 教练总数量
     * @return
     */
    @RequestMapping("/coachTotal")
    public Result coachTotal() {
        return Result.success(Constants.STATUS_200,chartsService.getCoachTotal());
    }

    /**
     * 课程总数量
     * @return
     */
    @RequestMapping("/courseTotal")
    public Result courseTotal() {
        return Result.success(Constants.STATUS_200,chartsService.getCourseTotal());
    }

    /**
     * 预约总数量
     * @return
     */
    @RequestMapping("/reserveTotal")
    public Result reserveTotal() {
        return Result.success(Constants.STATUS_200,chartsService.getReserveTotal());
    }

    /**
     * 本周会员
     * @param date
     * @return
     */
    @RequestMapping("/weekMember")
    public Result weekMember(@DateTimeFormat(pattern = "yyyy-MM-dd") Date date) {
        return Result.success(Constants.STATUS_200,chartsService.getWeekMember(date));
    }

    /**
     * 本周课程
     * @param date
     * @return
     */
    @RequestMapping("/weekCourse")
    public Result weekCourse(@DateTimeFormat(pattern = "yyyy-MM-dd") Date date) {
        return Result.success(Constants.STATUS_200,chartsService.getWeekCourse(date));
    }

    /**
     * 本周预约数量
     * @param date
     * @return
     */
    @RequestMapping("/weekReserve")
    public Result weekReserve(@DateTimeFormat(pattern = "yyyy-MM-dd") Date date) {
        return Result.success(Constants.STATUS_200,chartsService.getWeekReserve(date));
    }

    /**
     * 本周代课教练
     * @param date
     * @return
     */
    @RequestMapping("/weekCoach")
    public Result weekCoach(@DateTimeFormat(pattern = "yyyy-MM-dd") Date date) {
        return Result.success(Constants.STATUS_200,chartsService.getWeekCoach(date));
    }

    /**
     * 热门课程
     * @param date
     * @return
     */
    @RequestMapping("/hotCourse")
    public Result hotCourse(@DateTimeFormat(pattern = "yyyy-MM-dd")Date date) {
        return Result.success(Constants.STATUS_200,chartsService.getHotCourse(date));
    }

    /**
     * 本周热门教练排行榜
     * @param date
     * @return
     */
    @RequestMapping("/hotCoach")
    public Result hotCoach(@DateTimeFormat(pattern = "yyyy-MM-dd") Date date) {
        return Result.success(Constants.STATUS_200,chartsService.getHotCoach(date));
    }

    /**
     * 课程预约趋势
     * @param date
     * @return
     */
//    @RequestMapping("/reserveCount")
//    public Result reserveCount(@DateTimeFormat(pattern = "yyyy-MM-dd") Date date) {
//        return Result.success(Constants.STATUS_200,chartsService.getWeekReserve(date));
//    }
}
